export const validateUsername = (rule, value, callback) => {
  const isPhoneEleven = value.search(/^\d{11}$/)
  if (isPhoneEleven === -1) {
    callback(new Error('账号必须是注册的11位的手机号码'))
  } else {
    callback()
  }
}

export const validateEmptyPassword = (rule, value, callback) => {
  if (value === '') {
    callback(new Error('密码不能为空'))
  } else if (value.length < 6) {
    callback(new Error('密码的长度不可能小于6'))
  } else {
    callback()
  }
}

export const validateRegisterPassword = (rule, value, callback) => {
  const valueStatus = value.search(/^(?=.*[a-zA-Z])(?=.*[0-9])[A-Za-z0-9]{6,15}$/) === -1
  if (valueStatus) {
    callback(new Error('密码必须含有字母和数字，在6-15个长度之间'))
  } else {
    callback()
  }
}

export const validateVerifyCode = (rule, value, callback) => {
  if (value === '') {
    callback(new Error('验证码不能为空'))
  } else {
    callback()
  }
}

